{% extends 'base.html' %}
{% block title %}详情页面{% endblock %}
{% block main %}
    <h3 class="page-title">{{ questions.title }}</h3>
    <p class="message-info">
        <span>作者: {{ questions.author.username }}</span>
        <span>时间: {{ questions.create_time }}</span>
    </p>
    <hr>
    <p class="question-content">
        {{ questions.content }}
    </p>
    <hr>
    <h4>评论: ({{ questions.answers|length }})</h4>
    <form method="post" action="{{ url_for('add_answer') }}">
        <div class="form-group">
            <input type="text" class="form-control" placeholder="请填写评论" name="answer_content">
            <input type="hidden" value="{{ questions.id }}" name="question_id">
        </div>
        <div class="form-group" style="text-align: right">
            <button class="btn btn-primary">立即评论</button>
        </div>
    </form>
    <ul class="answer-list">
        {% for answer in questions.answers %}
            <li>
                <div class="user_info">
                    <span class="glyphicon glyphicon-pencil avatar" aria-hidden="true"></span>
                    <span class="username">{{ answer.author.username }}</span>
                    <span class="create-time">{{ answer.create_time }}</span>
                </div>
                <p class="answer-content">{{ answer.content }}</p>
            </li>
        {% endfor %}
    </ul>
{% endblock %}